package com.czk.netty.netty.inboundandoutboundhandler.server;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ReplayingDecoder;

import java.util.List;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/1/22 22:06
 */
public class MyByteToLongDecode2 extends ReplayingDecoder<Void> {

    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {
        System.out.println("MyByteToLongDecode2被调用");
        // ReplayingDecoder 不需要判断数据是否足够读取，内部会进行判断处理
        list.add(byteBuf.readLong());
    }
}
